home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / PACKAGES / AWK320.ZIP / RMS.AWK < prev    next >
Text File  |  1987-12-11  |  432b  |  19 lines

  1. # A program to compute the square root of the
  2. # sum of the squares of a set of numbers.
  3. # The set of numbers is provided as input -
  4. # one number to a record.
  5. #
  6. # NR is the current record number.  In the END
  7. # section it is the number of records.
  8.  
  9. BEGIN {
  10.         sum_of_squares = 0
  11. }
  12. {
  13.         sum_of_squares += $1 * $1
  14. }
  15. END {
  16.         root_mean_square = sqrt(sum_of_squares / NR)
  17.         print root_mean_square
  18. }
  19.